package com.spring.controller;

import com.spring.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class LoginController {

    @Autowired
    private LoginService loginService;

    @RequestMapping({ "/login.do" })
    public ModelAndView login(String name, HttpServletRequest request, HttpServletResponse response){
        ModelAndView mv = new ModelAndView("index" );
        loginService.register("sdsdfd","上45345");
        mv.addObject("userRole", "ADMIN");
        return mv;
    }
}
